﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 学生信息管理系统
{
    public class Input
    {
   public  static   List<StudentsInfomation> Studens=new List<StudentsInfomation> ();
        public  StudentSystem ss;
        
        public void information()
        {
            while (true)
            {
                Console.Write("请输入ID：");
                int input1;
                while (!int.TryParse(Console.ReadLine(),out input1))
                {Console.Write("输入错误请输入整数:");}
                int id = input1;                           
                Console.Write("请输入姓名：");
                string name = Console.ReadLine();
                Console.Write("请输入性别,0为男，1为女：");
                int input;
                while (!int.TryParse(Console.ReadLine(), out input)||input>1||input<0)
                {
                    Console.Write("输入错误，请输入0或1：");
                }
                E_gender gender = (E_gender)input;
                Console.Write("请输入年级,高一为0，高二为1，高三为2：");
                int input2;
                while (!int.TryParse(Console.ReadLine(), out input2)||input2<0||input2>2)
                {
                    Console.Write("输入错误，请输入0,1或者2：");
                }
                E_GradeType gradetype = (E_GradeType)input2;
                Console.Write("请输入班级：");
                int eclass = Convert.ToInt32(Console.ReadLine());
                Console.Write("请输入你电话号码：");
                int input6;
                while (!int.TryParse(Console.ReadLine(), out input6))
                {
                    Console.WriteLine("输入错误请输入整数：");
                }

                int phone = input6;
                
                Console.Write("请输入邮箱：");
                string email = Console.ReadLine();
                Console.Write("请输入地址：");
                string address = Console.ReadLine();
                Console.Write("请输入QQ：");
                int input5;
                while (!int.TryParse(Console.ReadLine(), out input5))
                {
                    Console.WriteLine("输入错误请输入整数：");
                }

                int qq = input5;
                Console.WriteLine("请输入成绩：");
                int input4;
                while (!int.TryParse(Console.ReadLine(),out input4))
                {
                    Console.WriteLine("输入错误请输入整数：");
                }

                int score = input4;
                StudentsInfomation si = new StudentsInfomation(id, name, gender, gradetype, eclass, phone, email, address, qq, score);
                //ss.Addstudnt(si);
                Studens.Add(si);
                Console.WriteLine("请问还需要输入吗Y/N");
                if (Console.ReadLine() == "n" || Console.ReadLine() == "N")
                {
                    surface_chart.SceneSelectionMenu();
                }
               
            }
        }
        public static void ament()
        {
           
               
                Console.Write("请输入ID：");
                int input1;
                while (!int.TryParse(Console.ReadLine(),out input1))
                {Console.Write("输入错误请输入整数:");}
                int id = input1;                           
                Console.Write("请输入姓名：");
                string name = Console.ReadLine();
                Console.Write("请输入性别,0为男，1为女：");
                int input;
                while (!int.TryParse(Console.ReadLine(), out input)||input>1||input<0)
                {
                    Console.Write("输入错误，请输入0或1：");
                }
                E_gender gender = (E_gender)input;
                Console.Write("请输入年级,高一为0，高二为1，高三为2：");
                int input2;
                while (!int.TryParse(Console.ReadLine(), out input2)||input2<0||input2>2)
                {
                    Console.Write("输入错误，请输入0,1或者2：");
                }
                E_GradeType gradetype = (E_GradeType)input2;
                Console.Write("请输入班级：");
                int eclass = Convert.ToInt32(Console.ReadLine());
                Console.Write("请输入你电话号码：");
                int input6;
                while (!int.TryParse(Console.ReadLine(), out input6))
                {
                    Console.WriteLine("输入错误请输入整数：");
                }

                int phone = input6;
                
                Console.Write("请输入邮箱：");
                string email = Console.ReadLine();
                Console.Write("请输入地址：");
                string address = Console.ReadLine();
                Console.Write("请输入QQ：");
                int input5;
                while (!int.TryParse(Console.ReadLine(), out input5))
                {
                    Console.WriteLine("输入错误请输入整数：");
                }

                int qq = input5;
                Console.WriteLine("请输入成绩：");
                int input4;
                while (!int.TryParse(Console.ReadLine(),out input4))
                {
                    Console.WriteLine("输入错误请输入整数：");
                }
                int score = input4;
            Console.WriteLine("请问还需要输入吗Y/N");

            if (Console.ReadLine() == "n" || Console.ReadLine() == "N")
                {
                    for (int i = 0; i < Studens.Count; i++)
                    {
                        if (Studens[i].ID == id)
                        {
                            Studens.RemoveAt(i);
                            StudentsInfomation si = new StudentsInfomation(id, name, gender, gradetype, eclass, phone, email, address, qq, score);
                            Studens.Add(si);
                        }
                        else
                        {
                            Console.WriteLine("没有那条数据");
                        }
                    }
                    
                    surface_chart.SceneSelectionMenu();
                }

            
        }
    }
}
